@extends('admin.layout.main')

@section('content')
<div class="breadcrumbs ace-save-state" id="breadcrumbs">
<ul class="breadcrumb">
	<li>
		<i class="ace-icon fa fa-home home-icon"></i>
		<a href="/admin/index">首页</a>
	</li>
	<li>
		<a href="/admin/tpl_index">消息模板管理</a>
	</li>
	<li class="active"><a href="{{ url('admin/message_index') }}">系统消息列表</a></li>
</ul><!-- /.breadcrumb -->

{{--<div class="nav-search" id="nav-search">--}}
	{{--<form class="form-search">--}}
		{{--<span class="input-icon">--}}
		{{--<input type="text" placeholder="Search ..." class="nav-search-input" id="nav-search-input" autocomplete="off" />--}}
			{{--<i class="ace-icon fa fa-search nav-search-icon"></i>--}}
		{{--</span>--}}
	{{--</form>--}}
{{--</div><!-- /.nav-search -->--}}
</div>
<form class="form-search" action="/admin/message_index" method="post">
    <span class="page-content">消息标题：</span>
    <span class="input-icon">
        <input type="hidden" name="_token" value="{{csrf_token()}}"/>
		<input type="text"  name="like_title" value="{{$like_title}}" class="nav-search-input" id="nav-search-input" autocomplete="off" />
		</span>
    <button class="btn btn-info" type="submit" >
        查找
    </button>
    </span>
</form>
<div class="page-content">
	<div class="row">
		<div class="col-xs-12">
			<!-- PAGE CONTENT BEGINS -->
			<div class="row">
				<div class="col-xs-12">
					<div class="clearfix">
						<div class="pull-right tableTools-container"></div>
					</div>
					<div class="table-header">
						<a href="{{ url('admin/message_create') }}">
						<i class="menu-icon fa fa-plus orange"></i>
						<span class="menu-text orange"> 添加系统消息 </span>
						</a>
					</div>

					<!-- div.table-responsive -->

					<!-- div.dataTables_borderWrap -->
					<div>
						<table id="dynamic-table" class="table table-striped table-bordered table-hover">
							<thead>
								<tr>
									<th>序号</th>
									<th>消息类型</th>
									<th>消息标题</th>
									<th>消息内容</th>
									<th class="hidden-480">添加时间</th>
									<th>
										<i class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>
										更新时间
									</th>
									<th>发送人员</th>
									<th class="hidden-480">操作</th>

									{{--<th></th>--}}
								</tr>
							</thead>

							<tbody>
							@foreach($list as $key=>$data)
								<tr>
									<td>{{$page_num++}}</td>
									<td>【系统消息】</td>
									<td>{{$data->title}}</td>
									<td>{{$data->content}}</td>
									<td>{{$data->created_at}}</td>
									<td>{{$data->updated_at}}</td>
									<td>{{empty($data->type)? '指定人发送':'群发'}}</td>

									<td><div class="hidden-sm hidden-xs action-buttons">
											<a class="blue" href="#">
												<i class="ace-icon fa fa-search-plus bigger-130"></i>
											</a>

											<a class="green" href="/admin/message_edit/{{$data->id}}">
												<i class="ace-icon fa fa-pencil bigger-130"></i>
											</a>

											<a class="red" href="javascript:void(0);" onclick="delData('{{$data->id}}')">
												<i class="ace-icon fa fa-trash-o bigger-130"></i>
											</a>
										</div>

										<div class="hidden-md hidden-lg">
											<div class="inline pos-rel">
												<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">
													<i class="ace-icon fa fa-caret-down icon-only bigger-120"></i>
												</button>

												<ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">
													<li>
														<a href="#" class="tooltip-info" data-rel="tooltip" title="View">
															<span class="blue">
																<i class="ace-icon fa fa-search-plus bigger-120"></i>
															</span>
														</a>
													</li>

													<li>
														<a href="/admin/message_edit/{{$data->id}}" class="tooltip-success" data-rel="tooltip" title="Edit">
															<span class="green">
																<i class="ace-icon fa fa-pencil-square-o bigger-120"></i>
															</span>
														</a>
													</li>

													<li>
														<a href="javascript:void(0);" onclick="delData('{{$data->id}}')" class="tooltip-error" data-rel="tooltip" title="Delete">
															<span class="red">
																<i class="ace-icon fa fa-trash-o bigger-120"></i>
															</span>
														</a>
													</li>
												</ul>
											</div>
										</div>
									</td>
								</tr>
							@endforeach
								{{--<tr>--}}
									{{--<td>--}}
										{{--<a href="#">app.com</a>--}}
									{{--</td>--}}
									{{--<td>$45</td>--}}
									{{--<td class="hidden-480">3,330</td>--}}
									{{--<td>Feb 12</td>--}}

									{{--<td class="hidden-480">--}}
										{{--<span class="label label-sm label-warning">Expiring</span>--}}
									{{--</td>--}}

									{{--<td>--}}
										{{--<div class="hidden-sm hidden-xs action-buttons">--}}
											{{--<a class="blue" href="#">--}}
												{{--<i class="ace-icon fa fa-search-plus bigger-130"></i>--}}
											{{--</a>--}}

											{{--<a class="green" href="#">--}}
												{{--<i class="ace-icon fa fa-pencil bigger-130"></i>--}}
											{{--</a>--}}

											{{--<a class="red" href="#">--}}
												{{--<i class="ace-icon fa fa-trash-o bigger-130"></i>--}}
											{{--</a>--}}
										{{--</div>--}}

										{{--<div class="hidden-md hidden-lg">--}}
											{{--<div class="inline pos-rel">--}}
												{{--<button class="btn btn-minier btn-yellow dropdown-toggle" data-toggle="dropdown" data-position="auto">--}}
													{{--<i class="ace-icon fa fa-caret-down icon-only bigger-120"></i>--}}
												{{--</button>--}}

												{{--<ul class="dropdown-menu dropdown-only-icon dropdown-yellow dropdown-menu-right dropdown-caret dropdown-close">--}}
													{{--<li>--}}
														{{--<a href="#" class="tooltip-info" data-rel="tooltip" title="View">--}}
															{{--<span class="blue">--}}
																{{--<i class="ace-icon fa fa-search-plus bigger-120"></i>--}}
															{{--</span>--}}
														{{--</a>--}}
													{{--</li>--}}

													{{--<li>--}}
														{{--<a href="#" class="tooltip-success" data-rel="tooltip" title="Edit">--}}
															{{--<span class="green">--}}
																{{--<i class="ace-icon fa fa-pencil-square-o bigger-120"></i>--}}
															{{--</span>--}}
														{{--</a>--}}
													{{--</li>--}}

													{{--<li>--}}
														{{--<a href="#" class="tooltip-error" data-rel="tooltip" title="Delete">--}}
															{{--<span class="red">--}}
																{{--<i class="ace-icon fa fa-trash-o bigger-120"></i>--}}
															{{--</span>--}}
														{{--</a>--}}
													{{--</li>--}}
												{{--</ul>--}}
											{{--</div>--}}
										{{--</div>--}}
									{{--</td>--}}
								{{--</tr>--}}

							</tbody>
						</table>
					</div>
				</div>
			</div>
			<!-- PAGE CONTENT ENDS -->
		</div><!-- /.col -->

		<div class="modal-footer no-margin-top">
			{{--<ul class="pagination pull-right no-margin">--}}
				{{--<li class="prev disabled">--}}
					{{--<a href="#">--}}
						{{--<i class="ace-icon fa fa-angle-double-left"></i>--}}
					{{--</a>--}}
				{{--</li>--}}

				{{--<li class="active">--}}
					{{--<a href="#">1</a>--}}
				{{--</li>--}}

				{{--<li>--}}
					{{--<a href="#">2</a>--}}
				{{--</li>--}}

				{{--<li>--}}
					{{--<a href="#">3</a>--}}
				{{--</li>--}}

				{{--<li class="next">--}}
					{{--<a href="#">--}}
						{{--<i class="ace-icon fa fa-angle-double-right"></i>--}}
					{{--</a>--}}
				{{--</li>--}}
			{{--</ul>--}}
			@if(empty($url_data))
				{{ $list->links() }}
			@else
				{{$list->appends($url_data)->links() }}
			@endif
		</div>
	</div><!-- /.row -->
</div><!-- /.page-content -->

<script>
	function delData(id) {
	    var url = '{{url('admin/message_destroy')}}';
	    $.get(url,{id:id},function(res){
	        if(res.status == 1){
	            layer.msg(res.msg,{icon:1});
	            location.reload();
			}else{
                layer.msg(res.msg,{icon:2});
            }
		})
    }
</script>
@endsection
